export var RandomizedSet = function () {
  this.dict = new Set()
}

/**
 * @param {number} val
 * @return {boolean}
 */
RandomizedSet.prototype.insert = function (val) {
  if (this.dict.has(val)) {
    return false
  }
  this.dict.add(val)
  return true
}

/**
 * @param {number} val
 * @return {boolean}
 */
RandomizedSet.prototype.remove = function (val) {
  return this.dict.delete(val)
}

/**
 * @return {number}
 */
RandomizedSet.prototype.getRandom = function () {
  const keys = Array.from(this.dict)
  const index = Math.floor(Math.random() * this.dict.size)
  console.log(this.dict, keys, index)
  return Number(keys[index])
}

/**
 * Your RandomizedSet object will be instantiated and called as such:
 * var obj = new RandomizedSet()
 * var param_1 = obj.insert(val)
 * var param_2 = obj.remove(val)
 * var param_3 = obj.getRandom()
 */
